#ifndef NIGHT_H
#define NIGHT_H

#include <QMainWindow>
#include <qpainter.h>
#include "dialog.h"
#include "item.h"

#include <QMainWindow>
#include <QPaintEvent>
#include <QAction>
#include <QVector>
#include <QMenu>

namespace Ui {
class Night;
}

class Night : public QMainWindow
{
    Q_OBJECT

public:
    explicit Night(QWidget *parent = nullptr);
    ~Night();
    void paintEvent(QPaintEvent *event);

    void initItems();
    void releaseItems();
    void newGame();
    void overGame();
    bool findAll();
    void drawItem(QPainter &painter, Item *);
    bool pointInGameArea(QPoint pt);
    void openEmptyItem(QPoint pt);
    void mousePressEvent(QMouseEvent *e);

    QMenu *menu1;
    QMenu *menu2;
    QMenu *menu3;

    QAction *easy;
    QAction *normal;
    QAction *hard;
    QAction *self;

public slots:
    void slot_newGame();
    void slot_level_easy();
    void slot_level_normal();
    void slot_level_hard();
    void slot_level_self();
    void slot_level_self_get();
    void slot_exit();

;

private:
    Ui::Night *ui;

    QPixmap flagImage;
    QPixmap bombImage;

    int rows;//行数
    int cols;//列数
    int mine;//雷数
    QVector<QPoint> Mines;
    QVector<QVector<Item*>> items;
    bool m_bGameFail;

    Dialog *dialogSelf;
};

#endif // NIGHT_H
